clear all
set more off
set scheme s2color
cd ""

use "sample.dta", clear

label define time 1 "Jan.10" 8 "Jan.17" 15 "Jan.24" 22 "Jan.31" 29 "Feb.7" 36 "Feb.14" 43 "Feb.21" 50 "Feb.28"
label values time time

****************
* Subfigure (1)
****************

preserve

bysort time: egen mean = mean(confn14)
bysort time: egen p5 = pctile(confn14), p(5)
bysort time: egen p95 = pctile(confn14), p(95)
bysort time: keep if _n == 1

#delimit ;
twoway (scatter mean time, msymbol(Sh) mcolor(orange) msize(small))
       (scatter p5   time, msymbol(Th) mcolor(eltblue) msize(small))
       (scatter p95  time, msymbol(Oh) mcolor(green) msize(small)), 
        xlabel(1(7)50, valuelabel axis(1) labsize(small) tlength(0.8))
        ylabel(, labsize(small) tlength(0.8) grid glwidth(vthin) nogextend)
        xtitle("Date") legend(label(1 "Mean") label(2 "5th percentile") 
        label(3 "95th percentile") position(2) ring(0) col(1) size(small))
        graphregion(fcolor(white) color(white) icolor(white) margin(small)) plotregion(margin(vsmall));
#delimit cr

restore

****************
* Subfigure (2)
****************

preserve

bysort time: egen mean = mean(d_movewithin)
bysort time: egen p5 = pctile(d_movewithin), p(5)
bysort time: egen p95 = pctile(d_movewithin), p(95)
bysort time: keep if _n == 1

#delimit ;
twoway (scatter mean time, msymbol(Sh) mcolor(orange) msize(small))
       (scatter p5   time, msymbol(Th) mcolor(eltblue) msize(small))
       (scatter p95  time, msymbol(Oh) mcolor(green) msize(small)), 
        xlabel(1(7)50, valuelabel axis(1) labsize(small) tlength(0.8))
        ylabel(, labsize(small) tlength(0.8) grid glwidth(vthin) nogextend)
        xtitle("Date") legend(label(1 "Mean") label(2 "5th percentile") 
        label(3 "95th percentile") position(8) ring(0) col(1) size(small))
        graphregion(fcolor(white) color(white) icolor(white) margin(small)) plotregion(margin(vsmall));
#delimit cr

restore

****************
* Subfigure (3)
****************

preserve

bysort time: egen mean = mean(bdindexS7)
bysort time: egen p5 = pctile(bdindexS7), p(5)
bysort time: egen p95 = pctile(bdindexS7), p(95)
bysort time: keep if _n == 1

#delimit ;
twoway (scatter mean time, msymbol(Sh) mcolor(orange) msize(small))
       (scatter p5   time, msymbol(Th) mcolor(eltblue) msize(small))
       (scatter p95  time, msymbol(Oh) mcolor(green) msize(small)), 
        xlabel(1(7)50, valuelabel axis(1) labsize(small) tlength(0.8))
        ylabel(, labsize(small) tlength(0.8) grid glwidth(vthin) nogextend)
        xtitle("Date") legend(label(1 "Mean") label(2 "5th percentile") 
        label(3 "95th percentile") position(11) ring(0) col(1) size(small))
        graphregion(fcolor(white) color(white) icolor(white) margin(small)) plotregion(margin(vsmall));
#delimit cr

restore
